using System.Data;
using ET;
namespace DAL
{
    public class Customer_Type_DAL
    {
        private readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdCustomer_Type(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Customer_Type_Search");
        }
        public DataTable BindGirdCustomer_TypeDetail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Customer_Type_ID", id);
            return cls.GetData("sp_tb_Customer_Type_Detail");
        }
        #endregion

        #region Insert
        public bool InsertCustomer_Type(Customer_Type_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Customer_Type_Alias", data.Customer_Type_Alias);
            cls.AddParameter("@Customer_Type_Name", data.Customer_Type_Name);
            cls.AddParameter("@Customer_Type_Note", data.Customer_Type_Note);
            cls.AddParameter("@Customer_Type_User_Add", data.Customer_Type_User_Add);
            cls.AddParameter("@Customer_Type_Date_Add", data.Customer_Type_Date_Add);
            cls.AddParameter("@Customer_Type_Computer_Add", data.Customer_Type_Computer_Add);
            return cls.ExecuteNonQuery("sp_tb_Customer_Type_Insert");
        }
        #endregion

        #region Update
        public bool UpdateCustomer_Type(Customer_Type_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Customer_Type_ID", data.Customer_Type_ID);
            cls.AddParameter("@Customer_Type_Alias", data.Customer_Type_Alias);
            cls.AddParameter("@Customer_Type_Name", data.Customer_Type_Name);
            cls.AddParameter("@Customer_Type_Note", data.Customer_Type_Note);
            cls.AddParameter("@Customer_Type_User_Modify", data.Customer_Type_User_Modify);
            cls.AddParameter("@Customer_Type_Date_Modify", data.Customer_Type_Date_Modify);
            cls.AddParameter("@Customer_Type_Computer_Modify", data.Customer_Type_Computer_Modify);
            return cls.ExecuteNonQuery("sp_tb_Customer_Type_Update");
        }
        #endregion

        #region Delete
        public bool DeleteCustomer_Type(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Customer_Type_ID", id);
            cls.ExecuteNonQuery("sp_tb_Customer_Type_Delete");
            return true;
        }
        #endregion
    }
}